﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Entity.Car_Rental
{
    /// <summary>
    /// 用户实体数据级验证（数据有效性验证）
    /// </summary>
    public partial class UserBases
    {

        public override IEnumerable<RuleViolation> GetRuleViolations()
        {
            #region 得到基类的非空验证迭代结果
            foreach (var violation in base.GetRuleViolations())
                yield return violation;
            #endregion

            if (string.IsNullOrEmpty(this.ConfirmPassword))
                yield return new RuleViolation("*", "ConfirmPassword");
            if (this.ConfirmPassword != this.Password && this.ConfirmPassword != this.NewPassword)
                yield return new RuleViolation("两次密码必须相同", "ConfirmPassword");
        }
    }
}
